<?php
/*------------------------------------------------------------------------

# TZ Portfolio Extension

# ------------------------------------------------------------------------

# author  TranLamTemPlaza

# copyright Copyright (C) 2012 templaza.com. All Rights Reserved.

# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL

# Websites: http://www.templaza.com

# Technical Support:  Forum - http://templaza.com/Forum

-------------------------------------------------------------------------*/

defined('_JEXEC') or die;

require_once JPATH_SITE.'/components/com_tz_portfolio/helpers/route.php';

class modtzrecentposts{
    static function getarticles($params){
        $number_title = $params ->get('number_title');

        $db = JFactory::getDbo();

        $query = $db ->getQuery(true);
        $query ->select(array('content.*'));
        $query ->from('#__content as content');

        $db ->setQuery($query,0,$number_title);

        if($articles = $db -> loadObjectList()){
            for($i = 0; $i < count($articles); $i++){
                $articles[$i] ->link   =  JRoute::_(TZ_PortfolioHelperRoute::getArticleRoute($articles[$i] -> id.':'
                .$articles[$i] ->alias, $rows[$i] -> catid));
            }
            return $articles;
        }
        return false;
    }
}